package com.ctbu.web;

import com.ctbu.entity.FinancialProduct;
import com.ctbu.service.FinancialProductService;
import com.ctbu.tools.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 金融衍生品表，包含衍生品的ID、名称和价格 前端控制器
 * </p>
 *
 * @author tanyan
 * @since 2024年06月27日
 */
@RestController

public class FinancialProductController {

    @Autowired
    private FinancialProductService financialProductService;

    @GetMapping
    public ResponseResult<Object> list(
            @RequestParam(value = "pageNum",required = false,defaultValue = "1") int pageNum,
            @RequestParam(value = "pageSiz",required = false,defaultValue = "10") int pageSize,
            @RequestParam(value = "productName",required = false,defaultValue = "") String productName
            ){
        return financialProductService.selectList(pageNum,pageSize,productName);

    }

    /**
     * 查询所有数据
     * @return
     */
    @GetMapping("/queryAll")
    public ResponseResult<Object> queryAll(){
        List<FinancialProduct> list = financialProductService.list();
        return ResponseResult.success(list,"查询成功");
    }



}
